package com.linkai.泛型;

/**
 * @Description: 泛型类
 * @Author: 林凯
 * @Date: 2021/10/21 22:26
 */
public class Test02 {
    public static void main(String[] args) {
        MyTest02<Integer> t1 = new MyTest02<>();
        MyTest02<String> t2 = new MyTest02<>();

        t1.setT(666);
        System.out.println(t1.getT());
        t2.setT("abc");
        System.out.println(t2.getT());
    }
}

// 自定义一个泛型类
class MyTest02<T> {
    private T t;

    public T getT() {
        return t;
    }

    public void setT(T t) {
        this.t = t;
    }
}
